#ifndef __UNION_FLAG_H_
#define __UNION_FLAG_H_

typedef union
{
	unsigned char byte;
	struct
	{
		unsigned char bit0 : 1;
		unsigned char bit1 : 1;
		unsigned char bit2 : 1;
		unsigned char bit3 : 1;
		unsigned char bit4 : 1;
		unsigned char bit5 : 1;
		unsigned char bit6 : 1;
		unsigned char bit7 : 1;
	} bits;
} Union_Flag;

extern Union_Flag Exception_Flag;
extern Union_Flag Sys_Flag, KEY_Flag, KEY_Long_Flag, LED_Flag,Voice_Flag, Child_Lock_Flag, Power_Save_Flag;

#define LED_AC_Flag 					LED_Flag.bits.bit0
#define LED_TYPE_Flag 					LED_Flag.bits.bit1
#define LED_DC_Flag 					LED_Flag.bits.bit2
#define LED_POWER_Flag 					LED_Flag.bits.bit3
#define LED_BACKLIGHT_Flag 				LED_Flag.bits.bit4
#define LED_car_power_Flag 				LED_Flag.bits.bit5
#define BACKLIGHT_Enable_Flag 			LED_Flag.bits.bit6
#define CAR_Enable_Flag 				LED_Flag.bits.bit7

#define USB_Enable_Flag 				Sys_Flag.bits.bit0
#define DC_Enable_Flag 					Sys_Flag.bits.bit1
#define wakeup_or_key_flag 				Sys_Flag.bits.bit2  //1锟斤拷锟斤拷  0锟斤拷锟斤拷
#define Machine_sys_once_on_flag 		Sys_Flag.bits.bit3
#define Machine_sys_on_flag 			Sys_Flag.bits.bit5
#define Machine_sand_sleep_flag 		Sys_Flag.bits.bit6
#define Machine_start_sleep_flag		Sys_Flag.bits.bit7

#define BEEP_flag 						Voice_Flag.bits.bit0
#define K1_LOCK_flag 					Voice_Flag.bits.bit1
#define BAT_PERCENT_CIRCLE_flag			Voice_Flag.bits.bit2
#define CHG_flag						Voice_Flag.bits.bit3
#define LOW_BAT_flag					Voice_Flag.bits.bit4
#define PACK_OVER_WEIGHT_flag			Voice_Flag.bits.bit5
#define INV_OVER_STACK_flag				Voice_Flag.bits.bit6
#define FAN_CTRL_flag					Voice_Flag.bits.bit7

/***********************************************************************************************************************
KEY
***********************************************************************************************************************/
#define OneClick_Time 					10
#define LongClick_Time 					200 
#define PowerSave_Time					200  /* 2 seconds */
#define ChildLock_Time					200  /* 2 seconds */
#define SetupMode_Time					200	 /* 2 seconds */
#define DefaultSettingClick_Time		1500 /* Default factory setting */
#define BacklightDelayOff_Time			(5*60*100) /* Back light delay off time */		

#define KEY_CLICK_CAR_Flag 				KEY_Flag.bits.bit0
#define KEY_CLICK_TYPE_Flag 			KEY_Flag.bits.bit1
#define KEY_CLICK_BACKLIGHT_Flag 		KEY_Flag.bits.bit2
#define KEY_CLICK_DC_Flag 				KEY_Flag.bits.bit3

#define CAR_DC12V_OVERLOAD_Flag 		KEY_Flag.bits.bit4
#define TYPEC_USBA_OVERLOAD_Flag 		KEY_Flag.bits.bit5
#define PACK_OVERTEMP_Flag 				KEY_Flag.bits.bit6
#define PACK_UNDERTEMP_Flag 			KEY_Flag.bits.bit7

#define KEY_LONG_BACKLIGHT_Flag 		KEY_Long_Flag.bits.bit0
#define KEY_LONG_RELEASE_BACKLIGHT_Flag KEY_Long_Flag.bits.bit1
#define	LONG_BACKLIGHT_S1_Cnt			KEY_Long_Flag.bits.bit2

#define KEY_LONG_DC12V_Flag 			KEY_Long_Flag.bits.bit3
#define KEY_LONG_RELEASE_DC12V_Flag 	KEY_Long_Flag.bits.bit4
#define	LONG_DC12V_Cnt					KEY_Long_Flag.bits.bit5

#define DEFAULT_SETTING_Flag			KEY_Long_Flag.bits.bit6
#define DEFAULT_SETTING_S1_Cnt			KEY_Long_Flag.bits.bit7

#define CHILD_LOCK_Flag					Child_Lock_Flag.bits.bit0
#define CHILD_LOCK_S1_Cnt				Child_Lock_Flag.bits.bit1
#define COMBOX_MAINKEY_Flag				Child_Lock_Flag.bits.bit2
#define COMBOX_DCKEY_Flag				Child_Lock_Flag.bits.bit3

#define SYSTEM_POWER_UP_Flag			Child_Lock_Flag.bits.bit4
#define CHARGING_POWER_UP_Flag			Child_Lock_Flag.bits.bit5

#define BACKLIGHT_WAKE_UP_Flag			Child_Lock_Flag.bits.bit6
#define SETUP_MODE_Flag					Child_Lock_Flag.bits.bit7

#define POWER_SAVE_Flag					Power_Save_Flag.bits.bit0
#define POWER_SAVE_S1_Cnt				Power_Save_Flag.bits.bit1
#define COMBOX_TYPEC_Flag				Power_Save_Flag.bits.bit2

#define LOW_BAT_10PERCENT_Flag			Power_Save_Flag.bits.bit3
#define LOW_BAT_5PERCENT_Flag			Power_Save_Flag.bits.bit4

#define INV_EXC_ACOUT_OV_Flag			Exception_Flag.bits.bit5
#define INV_EXC_ACOUT_UV_Flag			Exception_Flag.bits.bit6
#define INV_EXC_OLP_Flag				Exception_Flag.bits.bit7

#define MPPT_EXCEPTION_Flag				Exception_Flag.bits.bit0
#define MPPT_EXC_EXT_OC_Flag			Exception_Flag.bits.bit1
#define MPPT_EXC_MPPT_UP_Flag			Exception_Flag.bits.bit2
#define MPPT_EXC_EXT_OV100V_Flag		Exception_Flag.bits.bit3
#define MPPT_EXC_EXT_OV150V_Flag		Exception_Flag.bits.bit4
#define INV_EXCEPTION_Flag				Exception_Flag.bits.bit5
#define INV_EXC_ACIN_OV_Flag			Exception_Flag.bits.bit6
#define INV_EXC_ACIN_UV_Flag			Exception_Flag.bits.bit7
/***********************************************************************************************************************
icon
***********************************************************************************************************************/

#endif
